import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import {
  match
} from 'minimatch'


Vue.use(VueRouter)
// import VueRouter from "vue-router";
// 解决两次访问相同路由地址报错
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}


const routes = [{
    path: '/',
    name: 'home',
    component: Home,
    

  },
  {
    path: '/about',
    name: 'about',
   
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import( /* webpackChunkName: "about" */ '../views/About.vue')
  },
  {
    path: '/barlist',
    name: 'barlist',
   
    component: () => import('../views/BarList.vue'),
    redirect: '/add',
    children: [{
        path: '/school',
        name: 'school',
        component: () => import('../components/School.vue')
      },
      {
        path: '/user',
        name: 'user',
        component: () => import('../components/User.vue')
      },
      {
        path: '/add',
        name: 'add',
        component: () => import('../components/Add.vue')
      },
      {
        path: '/fpay',
        name: 'fpay',
        component: () => import('../components/Fpay.vue')
      },
      {
        path: '/unpay',
        name: 'unpay',
        component: () => import('../components/Unpay.vue')
      },
      {
        path: '/team',
        name: 'team',
        component: () => import('../components/Team.vue')
      },
      {
        path: '/import',
        name: 'import',
        component: () => import('../components/Import.vue')
      },
      {
        path: '/area',
        name: 'area',
        component: () => import('../components/Area.vue')
      }
    ]



  }
]

const router = new VueRouter({
  // mode: 'history',
  // base: process.env.BASE_URL,
  routes
})

export default router
